package com.aide.simplification.popedom.login;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.directwebremoting.annotations.RemoteProxy;

//@Component("JsGetLoginInfo")
//@RemoteProxy(creator = SpringCreator.class, creatorParams = @Param(name = "beanName", value = "JsGetLoginInfo"), name = "JsGetLoginInfo")
@RemoteProxy(name="JsGetLoginInfo") 
public class JsGetLoginInfo {
	public LoginUser getUserInfo(HttpServletRequest request,
			HttpServletResponse response) {
		PopSSO sso = new PopSSO(request, response);
		LoginUser lu = sso.ssoSync();
		return lu;
	}

	public LoginUser setCurrDept(String deptid, String deptname,
			HttpServletRequest request, HttpServletResponse response) {
		PopSSO sso = new PopSSO(request, response);
		LoginUser lu = sso.ssoSync();
		if (lu != null) {
			lu.setDeptid(deptid);
			lu.setDeptname(deptname);
			request.getSession().setAttribute("loginUser", lu);
		}
		return lu;
	}
}
